//当前模块实现：API接口统一管理
import requests from "./requests";
import mockAjax from "./mockAjax";
//三级联动接口 /api/product/getBaseCategoryList
export const reqCategoryList= ()=>{return requests({url:'/product/getBaseCategoryList',method:'get'})};
//轮播图接口banners
export const reqBannerList=()=>mockAjax.get("/banners")
//轮播图接口floors
export const reqFloorList=()=>mockAjax.get("/floors")

//Search模块：
//请求商品接口/api/list
export const reqSearchInfo=(params)=>requests({url:'/list',method:'post',data:params})

//Detail模块 /api/item/{ skuId }
export const reqDetailInfo=(skuId)=>requests({url:`/item/${skuId}`,method:'get'})

//购物车模块  获取购物车数据 /api/cart/cartList 一定要带UUID
export const reqCartList=()=>requests({url:'/cart/cartList',method:'get'})

//购物车模块  添加到购物车7.(对已有物品进行数量改动) /api/cart/addToCart/{ skuId }/{ skuNum }
export const reqAddToCart =({skuId,skuNum})=>requests({url:`/cart/addToCart/${skuId}/${skuNum}`,method:'post'})

//购物车模块  切换购物车商品选中状态  /api/cart/checkCart/{skuID}/{isChecked}
export const reqCheckCart=({skuId,isChecked})=>requests({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'})

//购物车模块  删除购物车商品 /api/cart/deleteCart/{skuId}
export const reqDeleteCart=(skuId)=>requests({url:`/cart/deleteCart/${skuId}`,method:'DELETE'})

//注册模块 获取验证码 /api/user/passport/sendCode/{phone} 
export const reqPhoneCode=(phone)=>requests({url:`/user/passport/sendCode/${phone}`,method:'get'})

//注册模块 完成注册 /api/user/passport/register post
export const reqRegister=(data)=>requests({url:'/user/passport/register',data,method:'post'})

//登陆模块 /api/user/passport/login post
export const userLogin =(data)=>requests({url:`/user/passport/login`,data,method:'post'})

//登陆模块 请求头带token获取登陆用户信息 http://182.92.128.115/api/user/passport/auth/getUserInfo
export const reqUserInfo=()=>requests({url:'/user//passport/auth/getUserInfo',method:'get'})

//退出登录 /api/user/passport/logout get 无参数
export const reqLogOut=()=>requests({url:'/user/passport/logout',method:'get'})

//trade页面 获取地址信息 /api/user/userAddress/auth/findUserAddressList get 无参数
export const reqUserAddressList=()=>requests({url:'/user/userAddress/auth/findUserAddressList',method:'get'})

//trade页面 获取订单页面信息 /api/order/auth/trade /order/auth/trade get 无参数
export const reqOrderInfo=()=>requests({url:'/order/auth/trade',method:'get'})

//trade页面 提交订单 /api/order/auth/submitOrder?tradeNo={tradeNo} post 有参数
export const reqsubmitOrder=(tradeNo,data)=>requests({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,data,method:'post'})

//pay页面 /api/payment/weixin/createNative/{orderId}
export const reqPayOrder=(orderId)=>requests({url:`/payment/weixin/createNative/${orderId}`,method:'get'})

//PAY页面 查询订单支付状态 /api/payment/weixin/queryPayStatus/{orderId}
export const reqPayStatus=(orderId)=>requests({url:`/payment/weixin/queryPayStatus/${orderId}`,method:"get"})

//个人中心页面 /api/order/auth/{page}/{limit} get
export const reqOrderAuth=(page,limit)=>requests({url:`/order/auth/${page}/${limit}`,method:'get'})